package com.moyu.shopapp.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.moyu.shopapp.entity.OrderItem;
import com.moyu.shopapp.entity.vo.CartGoodsVO;
import com.moyu.shopapp.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/orderItem")
public class OrderItemController {
    @Autowired
    private OrderItemService orderItemService;

    /**
     * 获取订单项
     * @param orderId 订单id
     * @return
     */
    @GetMapping("/findItemByOrderId")
    public List<OrderItem> findItemByOrderId(int orderId){
        return orderItemService.list(new LambdaQueryWrapper<OrderItem>().eq(OrderItem::getOrderId,orderId));
    }
}
